package com.kd.service.jobSeeker.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kd.bean.jobSeeker.Basic_information;
import com.kd.bean.jobSeeker.Online_resumes;
import com.kd.dao.jobSeeker.IBasic_informationDao;
import com.kd.dao.jobSeeker.IOnline_resumesDao;
import com.kd.service.jobSeeker.IOnline_resumesService;

@Service
@Transactional
public class Online_resumesServiceImpl implements IOnline_resumesService{

	@Autowired
	private IOnline_resumesDao onlineDao;
	
	@Autowired
	private IBasic_informationDao basic_information;
	
	@Override
	public Online_resumes queryByRes_id(Integer res_id) throws Exception {
		
		return onlineDao.queryByRes_id(res_id);
	}

	@Override
	public Boolean insertOnline_resumes(Online_resumes online_resumes,Integer basic_id) throws Exception {
		Boolean flag = onlineDao.insertOnline_resumes(online_resumes)>0;
		if(flag) {
			 List<Online_resumes> res_id = onlineDao.queryOnline_resumesByRes_name(online_resumes.getRes_name());
			basic_information.updateOnline_resumes(res_id.get((res_id.size()-1)).getRes_id(), basic_id);
		}
		return flag;
	}

	@Override
	public Boolean updateOnline_resumes(Online_resumes online_resumes) throws Exception {
	
		return onlineDao.updateOnline_resumes(online_resumes)>0;
	}

}
